<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<ui:composition xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                template="./index.xhtml"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://xmlns.jcp.org/jsf/core">
    <ui:define name="content">
            <div class="container-fluid">
                <h:form>
                    <p:dataTable var="post" value="#{postManagement.getPosts(1)}" rows="10"
                                 paginator="true" paginatorPosition="bottom"
                                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                 rowsPerPageTemplate="5,10,15" styleClass="borderless hiddencss">
                        <p:column>
                            <div class="media">
                                <a class="pull-left" href="#">
                                    <img class="media-object images img-border img-holder" 
                                         src="#{utilBean.contextPath}/resources/#{post.category.categoryType.imagePath}" alt="" />
                                </a>
                                <div class="media-body">
                                    <h:commandLink class="media-heading" styleClass="titleLink" value="#{post.title}" action="#{postCommentBean.showPost()}">
                                        <f:setPropertyActionListener target="#{postCommentBean.post}" value="#{post}" />
                                    </h:commandLink><br/>
                                    <lable class="text text-info">#{msg['creator']} </lable>
                                    <h:commandLink value="#{post.user.userName}" styleClass="userLink text-larger" action="#" />
                                    <lable class="text text-info"> - #{postManagement.convertDate(post.updateDate)}</lable><br/><br/>
                                    <p class="text text-justify postContent">
                                        <h:outputText value="#{postManagement.subContent(post,500)}... " escape="false" />
                                        <h:commandLink styleClass="text color-blue" 
                                                       value="#{msg['read-more']}" action="#{postCommentBean.showPost()}" >
                                            <f:setPropertyActionListener target="#{postCommentBean.post}" value="#{post}" />
                                        </h:commandLink>
                                    </p>
                                </div>
                            </div>
                        </p:column>
                    </p:dataTable>
                </h:form>
            </div>
    </ui:define>
</ui:composition>
